package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * 练习:简易的记事本
 */
public class Test2 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("demo.txt", true);
        while (true) {
            String line = scan.nextLine();
            byte[] data = null;
            if ("exit".equalsIgnoreCase(line)) {
                break;
            }
            data = line.getBytes(StandardCharsets.UTF_8);
            fos.write(data);
        }
        System.out.println("写出成功");
        fos.close();

    }
}
